package com.wedo.mall.adapter;

import android.content.Context;
import android.widget.TextView;

import com.e.library.adapter.Adapter;
import com.wedo.mall.R;
import com.wedo.mall.entity.MoneyLog;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

/**
 * Created by Lawrence on 2017/8/3.
 */

public class WalletDetailAdapter extends Adapter<MoneyLog> {

    private SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

    public WalletDetailAdapter(Context context, List<MoneyLog> moneylogs) {
        super(context, moneylogs);
    }

    @Override
    protected int layout() {
        return R.layout.item_moneylog;
    }

    @Override
    protected void bind(EHolder holder, MoneyLog moneylog, int position) {
        TextView tv_event= holder.find(R.id.tv_event);
        TextView tv_time= holder.find(R.id.tv_time);

        tv_event.setText(moneylog.event);
        tv_time.setText(format.format(new Date(Long.valueOf(moneylog.add_time+"000"))));
    }
}
